import { request } from '../utils/request.js'

// 注册
export const registerService = (data) =>
  request({ url: '/user/register', method: 'POST', data })

// 登录
export const loginService = (data) =>
  request({ url: '/user/login', method: 'POST', data })

// 修改用户信息
export const updateUserInfo = (data) =>
  request({ url: '/user/updateUserInfo', method: 'POST', data })

// 更新用户密码
export const updatePwdService = (data) =>
  request({ url: '/user/updatePwd', method: 'POST', data })

// 发布评论
export const publishComment = (data) =>
  request({ url: '/comment/publishComment', method: 'POST', data })

// 获取所有的评论
export const getAllComment = () => request({ url: '/comment/getAllComment' })

// 获取订单评论
export const getOrderComment = (orderId) => request({ url: `/comment/getOrderComment/${orderId}`})

// 更新用户余额
export const updateBalance = (userId, money) =>
  request({
    url: `/user/updateBalance?userId=${userId}&money=${money}`,
    method: 'POST',
  })
